<?php

class Sgit_Util_Profiler
{

    static function run()
    {

       
        $db = Zend_Db_Table::getDefaultAdapter();
        $profiler = $db->getProfiler();
        $query = $profiler->getLastQueryProfile();
        
        $table="<table class='tablesorter'>";
        $table.="<tr><th class='ui-state-active'></th><th class='ui-state-active'>ElapsedSecs</th><th class='ui-state-active'>Query</th><th class='ui-state-active'>QueryParams</th></tr>";
       
        foreach($profiler->getQueryProfiles() as $query) 
        {
            $table.="<tr class='ui-state-highlight'><td>".++$i."</td><td>".round($query->getElapsedSecs(),6)."</td><td>".$query->getQuery()."</td><td></tr>".implode('-',$query->getQueryParams())."</td>";
        
        }
        $table.="<tr class='ui-state-highlight' ><td>T</td><td>".round($profiler->getTotalElapsedSecs(),6)."</td><td colspan=2></td></tr>";
       
        
        $table.="</table>";
        
        print $table;

    }

}
